package com.yyl.render.render

import android.content.Context
import com.yyl.render.utils.AssetsUtils

class RGBARender : BaseRender() {


    override fun onStartRender(context: Context) {
        nativeSetProgramType(ProgramTypeVideo)
        nativeLoadShaderScript(ShaderVertex, AssetsUtils.load(context, "shader/image.vert"))
        nativeLoadShaderScript(ShaderFragment, AssetsUtils.load(context, "shader/image.frag"))
    }

    fun updateRGBA(
        width: Int,
        height: Int,
        data: ByteArray
    ){
        nativeUpdateFrame(IMAGE_FORMAT_RGBA,width, height, data)
        requestRender()
    }
    fun updateYUV(
        width: Int,
        height: Int,
        data: ByteArray
    ){
        nativeUpdateFrame(IMAGE_FORMAT_YUYV,width, height, data)
        requestRender()
    }
}
